package net.ikenna.yadet.core.data;

import net.ikenna.yadet.core.cellprocessor.*;

import java.util.*;

public interface Row {
    Object getColumnValue(String columnName);

    Row processWith(CellProcessor cellProcssor);

    int getNumberOfCells();

    Cell getCellFor(String columnName);

    void put(Object key, Object value);

    Set getColumns();

    public static class HtmlStrippingCellProcessor implements CellProcessor {

        public Cell process(Cell cell) {
            if (cell.containsString()) {
                String cellValue = (String) cell.getValue();
                String newCellValue = cellValue.replaceAll("\\<.*?\\>", "");
                cell.setValue(newCellValue);
            }
            return cell;
        }

    }
}
